package com.zhaosc.rx.eventbus;

import org.junit.Test;

import com.zhaosc.rx.bean.User;
import com.zhaosc.rx.utils.SleepUtils;

import io.reactivex.functions.Consumer;

public class RxEventBusTest {

	@Test
	public void test() {
//		RxEventBus.getDefault().observe(User.class).subscribe(new Consumer<User>() {
//			@Override
//			public void accept(User user) throws Exception {
//				System.out.println(Thread.currentThread().getName() + "*****" + user.toString());
//			}
//		});

		User user = new User();
		user.setPwd("zsc");
		user.setUsername("zsc");
		RxEventBus.getDefault().post(user);
	}
	
	public static void main(String[] args) {
		RxEventBus.getDefault().observe(User.class).subscribe(new Consumer<User>() {
			@Override
			public void accept(User user) throws Exception {
				System.out.println(Thread.currentThread().getName() + "*****" + user.toString());
			}
		});
		SleepUtils.sleep(200000L);
	}

}
